home *** CD-ROM | disk | FTP | other *** search
- /* Handle dialogs for Orbit.c */
- /* Copyright 1987 */
- /* David Palmer */
- /* Mail code 220-47 */
- /* California Institute Of Technology */
- /* Uses EasyDialog.c (also ⌐ 1987 By David Palmer) */
- /* Duplication, modification, and examination allowed on a */
- /* non-commercial basis only. Commercial use prohibited */
- /* without prior written agreement with the author. (This */
- /* includes sale by for-profit companies, and use as an */
- /* inducement to buy something.) */
-
- #include <DialogMgr.h>
- #include <EasyDialog.h>
- #include "orbit.h"
-
- #define PARAMETERS 256
- #define INITIAL 257
- #define BLAME 258
-
- int whichbutton = 1;
- extern double precision;
- extern double scale;
- extern double drawperiod;
- extern int trailstyle;
- extern int fcenter;
- extern int background;
- int unitlength = 4;
- double lengthunits[] = {1, 1e-2, 1, 1e3, 150e9, 9.4e15};
- int unitimage = 2;
- double imageunits[] = {1, 1, 72, 512};
- int unittime = 2;
- double timeunits[] = {1, 1, 86400., 3.15e7};
- int unitmass = 4;
- double massunits[] = {1, 1e-3, 1, 6e24, 2e30};
- int unitspeed = 4;
- double speedunits[] = {1, 1e-2, 1, 1e3, 4775, 3e8};
-
-
- int funcblame();
-
- PARTICLE pastat = {1, 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- {0, 0}};
-
- EDITEM parlist[] = {
- {2, 1, edbutton, &whichbutton, 0, NULL},
- {1, 4, edfloat, &precision, 1, NULL},
- {1, 6, edfloat, &scale, 1, NULL},
- {1, 8, edfloat, &drawperiod, 1, NULL},
- {5, 9, edrad, &unitlength, 1, NULL},
- {3, 15, edrad, &unitimage, 1, NULL},
- {3, 18, edrad, &unittime, 1, NULL},
- {3, 22, edrad, &trailstyle, 1, NULL},
- {1, 25, edcheck, &fcenter, 1, NULL},
- {1, 26, edcheck, &background, 1, NULL},
- {3, 27, edbutton, &whichbutton, 0, funcblame},
- {0, 0, edlast, NULL, 0, NULL}};
-
- EDITEM initlist[] = {
- {3, 1, edbutton, &whichbutton, 0, NULL},
- {7, 10, edfloat, &pastat, 1, NULL},
- {4, 17, edrad, &unitmass, 1, NULL},
- {5, 21, edrad, &unitlength, 1, NULL},
- {5, 26, edrad, &unitspeed, 1, NULL},
- {0, 0, edlast, NULL, 0, NULL}};
-
- EDITEM blamelist[] = {
- {1, 1, edbutton, &whichbutton, 0, NULL},
- {0, 0, edlast, NULL, 0, NULL}};
-
- GetParams()
- {
- scale /= (lengthunits[unitlength]/imageunits[unitimage]);
- drawperiod /= timeunits[unittime];
- if (1 == EasyDialog(PARAMETERS, parlist)) {
- scale *= (lengthunits[unitlength]/imageunits[unitimage]);
- drawperiod *= timeunits[unittime];
- return;
- } else
- exit(0);
- }
-
- GetInit(ppa)
- PARTICLE *ppa;
- {
- int whichbutton, i;
-
- whichbutton = EasyDialog(INITIAL, initlist);
- if (whichbutton != 3) {
- *ppa = pastat;
- ppa->m *= massunits[unitmass];
- for (i = 0 ; i < NDIMS ; i++) {
- ppa->f[i] = 0;
- ppa->x[i] *= lengthunits[unitlength];
- ppa->xt[i] = ppa->x[i];
- ppa->p[i] *= ppa->m * speedunits[unitspeed];
- }
- }
- return whichbutton;
- }
-
- int funcblame(pdi, pedi, pedihit, itemnum)
- DialogPtr pdi;
- EDITEM *pedi, *pedihit;
- {
- if (itemnum == 27) {
- EasyDialog(BLAME, blamelist);
- return 0;
- } else if (itemnum == 28) {
- /* load scenario */
- return 0;
- } else if (itemnum == 29) {
- /* load scenario */
- return 3;
- }
- }